prioritized route proof of concept #224
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proof of concept and proposal for prioritized requests.
Feature request issue #223
This approach examines
HTTP.Request
before spawning a thread in the:default
threadpool. If condition is true, it handles the request in the Main thread, which is a reserved thread in the:interactive
pool if you launched server with-t auto,1
Proposed API
new kwarg on
serve()
is_prioritized: (req::HTTP.Request) -> bool
Affects
parallel
mode; if the function returns true, the request will be handled in the current main thread instead of spawning a thread from the:default
threadpool. This allows the server to handle requests when all:default
threads are busy. The main use case is to allow health checks to respond when all worker threads are busy. For this to work, you should launch Julia with at least one dedicated interactive thread. e.g.--threads=auto,1
, see Julia multi-threading documentation.TODO